/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ylystudio.pms.ejb.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "task")
@NamedQueries({
    @NamedQuery(name = "Task.findAll", query = "SELECT t FROM Task t"),
    @NamedQuery(name = "Task.findByTaskId", query = "SELECT t FROM Task t WHERE t.taskId = :taskId"),
    @NamedQuery(name = "Task.findByTaskBegin", query = "SELECT t FROM Task t WHERE t.taskBegin = :taskBegin"),
    @NamedQuery(name = "Task.findByTaskVerify", query = "SELECT t FROM Task t WHERE t.taskVerify = :taskVerify"),
    @NamedQuery(name = "Task.findByTaskDescrip", query = "SELECT t FROM Task t WHERE t.taskDescrip = :taskDescrip"),
    @NamedQuery(name = "Task.findByTaskEnd", query = "SELECT t FROM Task t WHERE t.taskEnd = :taskEnd"),
    @NamedQuery(name = "Task.findByTaskFinish", query = "SELECT t FROM Task t WHERE t.taskFinish = :taskFinish"),
    @NamedQuery(name = "Task.findByTaskName", query = "SELECT t FROM Task t WHERE t.taskName = :taskName")})
public class Task implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "task_id")
    private Integer taskId;
    @Basic(optional = false)
    @Column(name = "task_begin")
    @Temporal(TemporalType.DATE)
    private Date taskBegin;
    @Basic(optional = false)
    @Column(name = "task_verify")
    private int taskVerify;
    @Column(name = "task_descrip")
    private String taskDescrip;
    @Basic(optional = false)
    @Column(name = "task_end")
    @Temporal(TemporalType.DATE)
    private Date taskEnd;
    @Column(name = "task_finish")
    @Temporal(TemporalType.DATE)
    private Date taskFinish;
    @Basic(optional = false)
    @Column(name = "task_name")
    private String taskName;
    @JoinColumn(name = "user_id", referencedColumnName = "user_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private User user;
    @JoinColumn(name = "lp_id", referencedColumnName = "lp_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private LeaderPlan leaderPlan;

    public Task() {
    }

    public Task(Integer taskId) {
        this.taskId = taskId;
    }

    public Task(Integer taskId, Date taskBegin, int taskVerify, Date taskEnd, String taskName) {
        this.taskId = taskId;
        this.taskBegin = taskBegin;
        this.taskVerify = taskVerify;
        this.taskEnd = taskEnd;
        this.taskName = taskName;
    }

    public Integer getTaskId() {
        return taskId;
    }

    public void setTaskId(Integer taskId) {
        this.taskId = taskId;
    }

    public Date getTaskBegin() {
        return taskBegin;
    }

    public void setTaskBegin(Date taskBegin) {
        this.taskBegin = taskBegin;
    }

    public int getTaskVerify() {
        return taskVerify;
    }

    public void setTaskVerify(int taskVerify) {
        this.taskVerify = taskVerify;
    }

    public String getTaskDescrip() {
        return taskDescrip;
    }

    public void setTaskDescrip(String taskDescrip) {
        this.taskDescrip = taskDescrip;
    }

    public Date getTaskEnd() {
        return taskEnd;
    }

    public void setTaskEnd(Date taskEnd) {
        this.taskEnd = taskEnd;
    }

    public Date getTaskFinish() {
        return taskFinish;
    }

    public void setTaskFinish(Date taskFinish) {
        this.taskFinish = taskFinish;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public LeaderPlan getLeaderPlan() {
        return leaderPlan;
    }

    public void setLeaderPlan(LeaderPlan leaderPlan) {
        this.leaderPlan = leaderPlan;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (taskId != null ? taskId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Task)) {
            return false;
        }
        Task other = (Task) object;
        if ((this.taskId == null && other.taskId != null) || (this.taskId != null && !this.taskId.equals(other.taskId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ylystudio.pms.ejb.entity.Task[taskId=" + taskId + "]";
    }

}
